<%@page import="java.util.ArrayList"%>
<%@page import="com.wanmait.movies.vo.Report"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<style type="text/css">
	.agree a{
	    margin-left:100px;
		color:green;
		text-decoration: none;
	}
	.disagree a{
	    color:red;
		text-decoration: none;
	}
	body{
	background-color: white;
	
	}
	#reportul{
	list-style:none;
	padding:0px 50px;
	
	}
	.name1{
	display:table-cell;
	border:1px solid gray;
	border-radius:2px;
	width:500px;
	padding-left:10px;
	}
</style>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">

$(function(){
	$("#reportul").on("click",".agree",function(){
		
		var rid =$(this).parent().attr("rid");
		
		$.ajax({
			url:"/movies/ManegerServlet?action=agreeReport",
			async:false,
			type:"get",
			data:"rid="+rid,
			success:function(){
				if(confirm("处理成功")){
					location.href="<%=request.getContextPath()%>/ManegerServlet?action=requestManegerReport";
				}
					
			}
		});
		
	});
});
	
$(function(){
	$("#reportul").on("click",".disagree",function(){
	var rid =$(this).parent().attr("rid");
		
		$.ajax({
			url:"/movies/ManegerServlet?action=disagreeReport",
			async:false,
			type:"get",
			data:"rid="+rid,
			success:function(){
				if(confirm("处理成功")){
					location.href="<%=request.getContextPath()%>/ManegerServlet?action=requestManegerReport";
				}
					
			}
		});
	});
});

</script>

</head>
<body>
	<ul id="reportul">
		<%
			ArrayList<Report> lists =(ArrayList<Report>)request.getAttribute("reportList");
		for(Report report : lists){%>
			<li rid="<%=report.getId()%>" > 
				<span ><%=report.getUserId().getUserName() %></span>
				<span>举报了</span>
				<span><%=report.getDiscussId().getUserId().getUserName() %></span>
				<span>对电影:<%=report.getDiscussId().getMovieId().getMovieName() %></span>
				<span>的评论:</span>
			
				<span class="name1"><%=report.getDiscussId().getMovieDiscuss() %></span>
				<br>
				<span class="agree"><a href="javascript:void(0);">&emsp;&emsp;同意举报</a></span>
				<span class="disagree"><a href="javascript:void(0);">&emsp;&emsp;驳回举报</a></span>
				<hr>
			</li>
		<%}
		%>
	
	</ul>
	
	
</body>
</html>